home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Games of Daze
/
Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso
/
x2ftp
/
msdos
/
source
/
zendisk1
/
lst7-8.asm
< prev
next >
Wrap
Assembly Source File
|
1990-02-15
|
1KB
|
49 lines
;
; *** Listing 7-8 ***
;
; Strips the high bit of every byte in a byte-sized array
; without using a segment override prefix.
;
jmp Skip
;
ARRAY_LENGTH equ 1000
TestArray db ARRAY_LENGTH dup (0ffh)
;
; Strips the high bit of every byte in a byte-sized array.
;
; Input:
; CX = length of array
; ES:BX = pointer to start of array
;
; Output: none
;
; Registers altered: AL, BX
;
StripHighBits proc near
push ds ;save normal DS
mov ax,es ;point DS to the array's
mov ds,ax ; segment
mov al,not 80h ;bit pattern for stripping
; high bits, loaded into a
; register outside the loop
; so we can use fast
; register-to-memory ANDing
; inside the loop
StripHighBitsLoop:
and [bx],al ;strip this byte's high bit
inc bx ;point to next byte
loop StripHighBitsLoop
pop ds ;restore normal DS
ret
StripHighBits endp
;
Skip:
call ZTimerOn
mov bx,seg TestArray
mov es,bx
mov bx,offset TestArray ;point to array
; which will have
; high bits stripped
call StripHighBits ;strip the high bits
call ZTimerOff